{extend name="admin@index_layout"/}
{block name="main"}


<div class="layui-card">
    <div class="layui-card-header">评价回复</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"
               data-auth-add="{:$auth->check('comment.commentList/add')}"
               data-auth-edit="{:$auth->check('comment.commentList/edit')}"
               data-auth-delete="{:$auth->check('comment.commentList/del')}"
        ></table>
    </div>
</div>

<script type="text/html" id="picTpl">

    <img style="max-width:80px; max-height:30px;" src="{{d.user_avatar_url}}" data-image="{{d.name}}">

</script>

<!--操作模板-->

{/block}
{block name="script"}
<script>
    var selectElement=null;
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: "{:url('add')}",
            edit_url: "{:url('edit')}",
            delete_url: "{:url('del')}",
        };
        var goods_list = {:json_encode($goods_list)};
        table.render({
            init: init,
            autoWidth: true,
            search:false,
            toolbar: ['refresh'],
            url: '{:url("replyList")}?id={$id}',
            cols: [
                [
                    // {type: 'checkbox', fixed: 'left'},
                    {field: 'id', width: '4%', title: 'ID'},
                    {field: 'user_avatar_url', align: "center", width: '10%', title: '图片', templet: '#picTpl', search: false},
                    {field: 'user_name', align: "center", width: '20%', title: '回复对象'},
                    {field: 'content', align: "center", width: '50%', title: '评价内容'},
                    {field: 'create_time', align: "center", width: '20%', title: '评价时间', search: 'range'},
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement = document.getElementById('c-province');
        selectElement.setAttribute("lay-filter", "c-province");
        form1();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
        var element = document.getElementById('layui-input-search');
        element.parentNode.removeChild(element);

    });
    function form1(){
        layui.use('form', function () {
            var form = layui.form;
            form.on('select(c-province)', function (data) {
                console.log(data.value);
                $.ajax({
                    type: "POST",//规定传输方式
                    url: "{:url('getc_cate')}",//提交URL
                    data: {'id':data.value},//提交的数据
                    success: function(result){
                        if(result.code == 200){
                            $("#c-city").empty();
                            var str = "<option value>- 全部 -</option>";
                            $.each(result.data, function(i, val){
                                str += '<option value='+val.id+'>'+val.name+'</option>'
                            });
                            $("#c-city").append(str);
                            layui.form.render('select');
                        }
                    },
                    error: function() {
                        alert("获取信息失败")
                    }
                });
            })
        });
    }




</script>
{/block}